<html>
<head><meta charset="utf-8"><title>read2 · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/read2.html">read2</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="202744886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/read2/near/202744886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/read2.html#202744886">(Jul 02 2020 at 21:09)</a>:</h4>
<p>There are several "read2" implementation (or copies of the same one) floating around -- e.g., <a href="https://github.com/rust-lang/cargo/blob/master/src/cargo/util/read2.rs">Cargo</a>, <a href="https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/pipe.rs">std</a>, <a href="https://github.com/rust-lang/rust/blob/master/src/tools/compiletest/src/read2.rs">compiletest 1</a> and <a href="https://github.com/rust-lang/rust/blob/d462551a8600e57d8b6f87e71ea56868bc5da6cf/src/tools/compiletest/src/runtest.rs#L3515">2</a>.</p>
<p>I would like to propose adding them -- in some fashion -- to std, perhaps as a function on <a href="https://doc.rust-lang.org/nightly/std/process/struct.Child.html">std::process::Child</a> to start.</p>
<p>Do we feel that there's interest in this? I would be willing to try and invest some time in hashing out a reasonable API that works for the primary use cases if so. Bringing this up because I just ran across another case where I wanted this -- to stream stdout/err in perf.rlo's logging -- and would rather avoid copying things. I'd also be open to pulling this out to a crate if we think that's the right next step here -- I personally think it's a good fit for builtin functionality though as it's not too niche and relatively platform-specific.</p>



<a name="202805931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/read2/near/202805931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BurntSushi <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/read2.html#202805931">(Jul 03 2020 at 13:54)</a>:</h4>
<p>i would be interested, yeah. i would use it in ripgrep instead of using threads to achieve the same goal: <a href="https://github.com/BurntSushi/ripgrep/blob/master/crates/cli/src/process.rs">https://github.com/BurntSushi/ripgrep/blob/master/crates/cli/src/process.rs</a></p>



<a name="202986625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/read2/near/202986625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/read2.html#202986625">(Jul 06 2020 at 13:14)</a>:</h4>
<p>Okay! I'll add it to my todo list then.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>